package model

import (
	"time"

	"gorm.io/datatypes"
)

type EquipmentPurchase struct {
	PurchaseID            uint           `gorm:"primaryKey;autoIncrement" json:"purchase_id"`
	Title                 string         `gorm:"type:varchar(100);not null" json:"title"`
	City                  string         `gorm:"type:varchar(50);not null" json:"city"`
	EquipmentCondition    string         `gorm:"type:enum('全新','二手','不限');default:'不限'" json:"equipment_condition"`
	Budget                float64        `gorm:"type:decimal(12,2);not null" json:"budget"`
	Department            string         `gorm:"type:varchar(50)" json:"department"`
	Brief                 string         `gorm:"type:varchar(20);not null" json:"brief"`
	Details               string         `gorm:"type:text;not null" json:"details"`
	ContactName           string         `gorm:"type:varchar(50);not null" json:"contact_name"`
	ContactPhone          string         `gorm:"type:varchar(20);not null" json:"contact_phone"`
	PublishTime           time.Time      `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"publish_time"`
	UserID                uint           `gorm:"not null" json:"user_id"`
	IsDeleted             bool           `gorm:"column:is_deleted;default:false;comment:是否已软删除"`
	DeviceType            string         `gorm:"type:varchar(50)" json:"device_type"`
	CertificationRequired bool           `gorm:"default:true" json:"certification_required"`
	Status                string         `gorm:"type:enum('求购中','已终止','已成交');default:'求购中'" json:"status"`
	TechnicalParameters   string         `gorm:"type:text" json:"technical_parameters"`
	Configurations        datatypes.JSON `gorm:"type:json" json:"configurations"`
}

func (EquipmentPurchase) TableName() string {
	return "EquipmentPurchase"
}
